package cate.game.play.buff.h;

import cate.game.play.buff.BuffHandler;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.proce.action.ctx.SkillActionCtx;

/**
 * 受击时，受到基于发起者攻击力15%的伤害，持续3回合或受到3次攻击
 */
public class 震伤BH extends BuffHandler {

	private double 系数;

	private int 次数;

	//系数=1500&次数=3
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		系数 = args.getWDouble("系数", 0d);
		次数 = args.getInt("次数", 0);
	}

	private int num;

	@Override
	public void afterSufferOneAttack(SkillActionCtx action, long totalDamage, boolean strike) {
		buff.owner.attr.buffHurt(action, buff.caster, buff.caster.attr.attTotal() * 系数);
		num++;
		if (num >= 次数) {
			buff.markInvalid(action);
		}
	}
}
